Embedded Programming

Texto Justificado

Group assignment:

  • Browse through the datasheet for your microcontroller.
  • Compare the performance and development workflows for other architectures.
  • Document your work to the group work page and reflect on your individual page what you learned.

Individual assignment:

  • Write a program for a microcontroller development board to interact (with local input &/or output devices) and communicate (with remote wired or wireless devices)

Group Assignment

  • Here is the link where you can see the development of the week's group assignment.Group Assignment

During this week 6 of group work, we met with the Fablab Perú team, based in Lima, while I participated from Huánuco. Our objective was to conduct discussions and comparisons on the microcontrollers selected for our study. Each of us dedicated ourselves to the detailed analysis of a specific microcontroller, in my case I was talking about the Attiny1624 AVR, then presenting our findings to our classmates.

  • Step 1: Explore the ATTINY1624 microcontroller datasheet.

ATTINY1624

I decided to study this microcontroller from the AVR family because, despite its very small size, it offers a wide range of features. I plan to deepen its knowledge by consulting its data sheet and exploring its various functionalities in greater detail.

  • 14 pin package.
  • Two internal clocks 16 and 20 MHz.
  • 16 KB Flash Memory.
  • 256 B EEPROM.
  • 2 KB SRAM.
  • Maximum voltage: 6V; minimum voltage -0.5 V.
  • Accurate analog features such as a 12-bit differential ADC with Programmable Gain Amplifier (PGA).
  • VDD: Supply voltage.
  • GND: Ground.
  • Digital pins: Port A: PA0, PA1, PA2, PA3, PA4, PA5, PA6, PA7. Port B: PB0, PB1, PB2, PB3.
  • Analog pins: PA1, PA2, PA3, PA4, PA5, PA6, PA7. Port B: PB0, PB1.
  • UPDI Programming pin: PA0 (physical pin number 10).
  • External Clock Pin: PA3.

  • All I/O pins can be configured with internal pullup resistance. Within the communications section there are different types and their pins are different. It is clear that the different communication protocols cannot all be used at the same time, because they have pins in common.
  • USART - Universal Synchronous and Asynchronous Receiver and Transmitter: It has the RX (PB2 or PA2) and the TX (PB3 or PA1).
  • SPI - Serial Peripheral Interface: It has only MOSI (PA1), MISO (PA2), SCK (PA3), SS (PA4).
  • TWI - Two Wire Interface (I2C): It has SDA (PB1 or PA1) and SCL (PB0 or PA2).

Step 2: Compare performance and development workflows for other architectures

1. Other architectures to compare:

  • For a comprehensive comparison, we chose ATTINY412, SAMD11C, XIAO RP2040 and XIAO ESP32-C3 microcontrollers.

2. Analyze the specifications and features:

  • Comparing with the ATTINY412, we notice that they share the same 8-bit AVR architecture, but the ATTINY1624 has a larger Flash memory and a higher clock frequency.
  • When contrasting with the SAMD11C, we observe that the ATTINY1624 consumes less power but has less SRAM memory and I/O capabilities compared to the 32-bit ARM Cortex-M0+ architecture SAMD11C.
  • Regarding the XIAO RP2040 and XIAO ESP32-C3 microcontrollers, we note that they offer greater memory capacities and processing power, along with advanced connectivity features, but at the cost of potentially higher power consumption.

Group Assignment Conclusion

The experience I have had this week working as a team has been extraordinary. We have learned a lot thanks to our joint collaboration. Each of us dedicated ourselves to studying the data sheet of the assigned microcontroller and subsequently shared our conclusions about the advantages of these devices. This process allowed us to acquire knowledge quickly and efficiently. Without a doubt, teamwork has been key to this success.

Although I didn't have the opportunity to work directly with the Attiny1624, its potential for special applications is truly impressive. Likewise, the other microcontrollers I mentioned above are also very promising. In fact, I have already placed an order to purchase them and thus expand my personal inventory. I'm looking forward to putting everything we've learned into practice and exploring the functionalities detailed in their data sheets.


Individual Assignments

For my individual task, I designed a board for the Xiao electronic card compatible with the ESP-C3 and RP2040. I developed this board using my homemade CNC, which I introduced during week 4. My goal was to explore new functionality while making progress on my final project. This experience allowed me to put my design and manufacturing skills into practice, while also contributing to the progress of my ongoing project.

Making my electronic board

For the design of my electronic board, I chose to use Eagle software. The steps I followed were as follows: first, I opened a new project and then 'Schematic'. This allowed me to start the design process in an organized and structured way using the tools provided by EAGLE .

Imagen pic281

New project.


Imagen pic282

New Schematic.

Once on the blank page of the Eagle software, I started by adding the necessary components, such as the XIAO ESP32-C3, and proceeded to to import the corresponding libraries. Teamwork was of great help in this process, since it allowed us to learn more about the characteristics and advantages of these components. This was essential for the development of the electronic board as my final project required it, allowing me to customize the inputs and outputs according to the specific needs of the project.

Imagen pic283

Add component.


Imagen pic284

Place Adding libraries.

In the Eagle software toolbar, we proceeded to add components, selecting the XIAO ESP32-C3 card model to import it. Once imported, we chose the pins we needed to configure and then assigned the corresponding names to those pins. This process allowed us to prepare the electronic board to adapt it to the specific needs of our project.

Imagen pic285

Importing to XIAO ESP32-C3.


Imagen pic286

XIAO pin recognition.

I then proceeded to change the names based on the information provided in the XIAO ESP32-C3 datasheet. Later, I added the connectors and other necessary components following the same naming process. Finally, I completed the electronic board, as shown in the attached image.

Imagen pic287

Configuring the names of the XIAO ESP32-C3.


Imagen pic288

Board layout and final components.

Once the connections of each component with the XIAO ESP32-C3 were completed, we proceeded to route and distribute the electronic components on the board. At this point, we were asked to save the project and subsequently a new window was opened where we organized the components in an orderly manner to facilitate the process of designing and manufacturing the board.

Imagen pic289

Component distribution.


Imagen pic290

Component routing and ordering window.

We make a proper layout of all the components inserted into the board, designing it in a way that it serves as a versatile testing platform. We incorporate an OLED LCD, three analog sensors, an RGB module and a BMP280 sensor. The result is shown in the attached image. However, we are aware that this design can be further optimized for future iterations, as a version ("V2"), better adapting it to the specific needs of our final project.

Imagen pic290

End plate to produce.

Once the design is complete, the next step is manufacturing the board. To do this, we resorted to the step-by-step process we learned during week 4. We used Flatcam to carry out the necessary processing, making sure to adjust the parameters according to the specifications of our manufacturing machine.

Imagen pic292

Import gerber made.

Imagen pic294

Set the parameters according to the machine.

The next step is to generate the G-code files for production using the electronic board CNC.

Imagen pic295

Gcode generation rotation.

Imagen pic296

Gcode generation cut.

Imagen pic295

Routing the board.

Imagen pic296

Plate cutting.

Imagen pic295

Placing the components.

Imagen pic296

.

Programming XIAO RP2040 and XIAO ESP32-C3

For this task, we will carry out the installation and selection of the XIAO RP2040, in order to program a set of instructions that fits our specific needs.

Imagen pic251

Installing the driver.

Imagen pic252

Selecting the electronic board.

The next step is to program the previously developed board, which has three soldered LEDs and a button or pushbutton that we can use as input, while the LEDs act as output.

After entering the code and declaring the variables, we move on to configure them in the corresponding settings section. Once configured, we proceed to implement the light sequence.

Imagen pic295
Setting the variables.
Imagen pic296

.

You can see the play of lights generated by the preconfigured LEDs on the control board. These strategically arranged LEDs offer a dynamic and captivating display that complements the system's functionality.



Imagen pic295

LED control board.

LED sequence.

I also performed another test shown in the example below: testing an OLED LCD. I carried out this evaluation using a control board designed specifically to meet my needs.

Imagen pic251

Variable configuration OLED.

Imagen pic252

Selection of RP2040 electronic board.

We loaded the program using the Arduino IDE and you can see its progress in the images below.

Imagen pic251

Variable configuration OLED.

Imagen pic252

Selection of RP2040 electronic board.

Finally, I present the tests carried out on the board with the XIAO RP2040. The performance and capabilities of this controller are truly impressive.



Imagen pic295

Oled LCD.

OLED LCD control.

You can improve this: Finally, I tested a water quality sensor using the TDS sensor, an OLED LCD and the XIAO ESP32-C3, I carry out these tests since my final project is related to this specific topic

Imagen pic251

Variable configuration.

Imagen pic252

Selection of XIAO ESP32-C3 electronic board.

After compiling the code correctly and checking for errors, we proceed to load the program on the XIAO ESP32-C3.

Imagen pic251

LOADING the program.

Imagen pic252

Loading finished.

Finally, we proceed to carry out tests on the developed board, using the same components mentioned above, as can be seen in the following example

Oled LCD and TDS.

Own control board


In summary

With great enthusiasm, I carried out the individual assignment, which gave me the opportunity to experiment with the XIAO RP2040 and XIAO ESP32-C3 control boards. I made small examples based on the requirements of my final project, which motivated me to improve this board to achieve a more efficient and compact pin layout. This process allowed me to become more familiar with the XIAOs and design a board that perfectly fit my needs.

Link to files used this week

1. Button-led.
2. TDS-oled
3. Oled LCD.